package com.wmm.fast.main.shop2AbstractFactory.simpleFactory2AbstractFactory;

import com.wmm.fast.main.shop2AbstractFactory.UserFactory;
import lombok.Data;

/**
 * @Auther: wangzun
 * @Date: 2018/9/13 15:10
 * @Description: 聚合工厂
 */
@Data
public class DataAccess {
    //此为聚合工厂封装变化的关键key 可通过配置 或逻辑指定达到变化 ,开放访问 模拟变化
    public static String dbName = "Mysql";

    private static String pacakges = "com.wmm.fast.main.shop2AbstractFactory.";

    public static UserFactory createUser() throws Exception {
        Class<?> className = Class.forName(pacakges + dbName + "UserFactory");
        return (UserFactory) className.newInstance();
    }

}
